<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Origami::XRef</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Origami::XRef</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/origami/xreftable_rb.html">
                origami/xreftable.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
Class representing a Cross-reference information.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000427">new</a>&nbsp;&nbsp;
      <a href="#M000428">to_s</a>&nbsp;&nbsp;
      <a href="#M000429">to_xrefstm_data</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">

    <div id="class-list">
      <h3 class="section-bar">Classes and Modules</h3>

      Class <a href="XRef/Section.html" class="link">Origami::XRef::Section</a><br />
Class <a href="XRef/Subsection.html" class="link">Origami::XRef::Subsection</a><br />

    </div>

    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">FREE</td>
          <td>=</td>
          <td class="context-item-value">&quot;f&quot;</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">USED</td>
          <td>=</td>
          <td class="context-item-value">&quot;n&quot;</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">FIRSTFREE</td>
          <td>=</td>
          <td class="context-item-value">65535</td>
        </tr>
        </table>
      </div>
    </div>



    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">generation</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">offset</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">state</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000427" class="method-detail">
        <a name="M000427"></a>

        <div class="method-heading">
          <a href="#M000427" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(offset, generation, state)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Creates a <a href="XRef.html#M000427">new</a> <a href="XRef.html">XRef</a>.
</p>
<table>
<tr><td valign="top"><em>offset</em>:</td><td>The file <em>offset</em> of the referenced <a
href="Object.html">Object</a>.

</td></tr>
<tr><td valign="top"><em>generation</em>:</td><td>The generation number of the referenced <a href="Object.html">Object</a>.

</td></tr>
<tr><td valign="top"><em>state</em>:</td><td>The state of the referenced <a href="Object.html">Object</a> (FREE or
USED).

</td></tr>
</table>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000427-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000427-source">
<pre>
    <span class="ruby-comment cmt"># File origami/xreftable.rb, line 78</span>
78:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">offset</span>, <span class="ruby-identifier">generation</span>, <span class="ruby-identifier">state</span>)
79:     
80:       <span class="ruby-ivar">@offset</span>, <span class="ruby-ivar">@generation</span>, <span class="ruby-ivar">@state</span> = <span class="ruby-identifier">offset</span>, <span class="ruby-identifier">generation</span>, <span class="ruby-identifier">state</span>
81:     
82:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000428" class="method-detail">
        <a name="M000428"></a>

        <div class="method-heading">
          <a href="#M000428" class="method-signature">
          <span class="method-name">to_s</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Outputs self into <a href="PDF.html">PDF</a> code.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000428-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000428-source">
<pre>
     <span class="ruby-comment cmt"># File origami/xreftable.rb, line 100</span>
100:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
101:       <span class="ruby-identifier">off</span> = (<span class="ruby-value str">&quot;0&quot;</span> <span class="ruby-operator">*</span> (<span class="ruby-value">10</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@offset</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">length</span>)) <span class="ruby-operator">+</span> <span class="ruby-ivar">@offset</span>.<span class="ruby-identifier">to_s</span>
102:       <span class="ruby-identifier">gen</span> = (<span class="ruby-value str">&quot;0&quot;</span> <span class="ruby-operator">*</span> (<span class="ruby-value">5</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@generation</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">length</span>)) <span class="ruby-operator">+</span> <span class="ruby-ivar">@generation</span>.<span class="ruby-identifier">to_s</span>
103:       
104:       <span class="ruby-node">&quot;#{off} #{gen} #{@state}&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-constant">EOL</span>
105:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000429" class="method-detail">
        <a name="M000429"></a>

        <div class="method-heading">
          <a href="#M000429" class="method-signature">
          <span class="method-name">to_xrefstm_data</span><span class="method-args">(type_w, field1_w, field2_w)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000429-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000429-source">
<pre>
     <span class="ruby-comment cmt"># File origami/xreftable.rb, line 107</span>
107:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_xrefstm_data</span>(<span class="ruby-identifier">type_w</span>, <span class="ruby-identifier">field1_w</span>, <span class="ruby-identifier">field2_w</span>)
108:       <span class="ruby-identifier">type_w</span> <span class="ruby-operator">&lt;&lt;=</span> <span class="ruby-value">3</span>
109:       <span class="ruby-identifier">field1_w</span> <span class="ruby-operator">&lt;&lt;=</span> <span class="ruby-value">3</span>
110:       <span class="ruby-identifier">field2_w</span> <span class="ruby-operator">&lt;&lt;=</span> <span class="ruby-value">3</span>
111: 
112:       <span class="ruby-identifier">type</span> = ((<span class="ruby-ivar">@state</span> <span class="ruby-operator">==</span> <span class="ruby-constant">FREE</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;\000&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;\001&quot;</span>).<span class="ruby-identifier">unpack</span>(<span class="ruby-node">&quot;B#{type_w}&quot;</span>)[<span class="ruby-value">0</span>]
113: 
114:       <span class="ruby-identifier">offset</span> = <span class="ruby-ivar">@offset</span>.<span class="ruby-identifier">to_s</span>(<span class="ruby-value">2</span>)
115:       <span class="ruby-identifier">offset</span> = <span class="ruby-value str">'0'</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">field1_w</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">offset</span>.<span class="ruby-identifier">size</span>) <span class="ruby-operator">+</span> <span class="ruby-identifier">offset</span>
116:       <span class="ruby-identifier">generation</span> = <span class="ruby-ivar">@generation</span>.<span class="ruby-identifier">to_s</span>(<span class="ruby-value">2</span>)
117: 
118:       <span class="ruby-identifier">generation</span> = <span class="ruby-value str">'0'</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">field2_w</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">generation</span>.<span class="ruby-identifier">size</span>) <span class="ruby-operator">+</span> <span class="ruby-identifier">generation</span>
119: 
120:       [ <span class="ruby-identifier">type</span> , <span class="ruby-identifier">offset</span>, <span class="ruby-identifier">generation</span> ].<span class="ruby-identifier">pack</span>(<span class="ruby-node">&quot;B#{type_w}B#{field1_w}B#{field2_w}&quot;</span>)
121:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>